package br.ufal.questione.dao.domain;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import br.ufal.questione.dao.QuestionarioDao;
import br.ufal.questione.domain.Curso;
import br.ufal.questione.domain.Questionario;
import br.ufal.questione.util.DbTestUtil;

public class HibernateQuestionarioDaoTest extends DbTestUtil{

	@Autowired
	private QuestionarioDao questionarioDao;
	
	@Before
	public void setUp() throws Exception {
	}
	
	@Test
	public void testConsultarPorId() throws Exception {
		Long pk = 1L;
		Questionario questionario = questionarioDao.consultar(pk);
		assertEquals("objeto incorreto!", "Teste 1", questionario.getDescricao());
	}
	
	@Test
	public void testInserir() throws Exception {
		
	}
	
	@Test
	public void testDeletar() throws Exception {
//		Long pk = 1L;
//		Questionario questionario = questionarioDao.consultar(pk);
//		questionarioDao.excluir(questionario);
//		List<Questionario> questionarios = questionarioDao.listar();
//		assertEquals("Numero incorreto de objetos", 1, questionarios.size());
	}
	
	@Test
	public void testListarTodos() throws Exception{
		List<Questionario> questionarios = questionarioDao.listar();
		assertEquals("Numero incorreto de objetos", 2, questionarios.size());
	}
}
